<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <th:block th:include="include :: header('GS1码管理')" />
    <meta charset="UTF-8">
    <title>DI码管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <!-- 避免IE使用兼容模式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="../../../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}">
    <link rel="stylesheet" href="../../../static/udi/dist/css/layui.css" th:href="@{/udi/dist/css/layui.css}">
    <link href="../../../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <!-- bootstrap-table 表格插件样式 -->
    <link href="../../../static/ajax/libs/bootstrap-table/bootstrap-table.min.css" th:href="@{/ajax/libs/bootstrap-table/bootstrap-table.min.css}" rel="stylesheet"/>
    <link href="../../../static/css/animate.css" th:href="@{/css/animate.css}" rel="stylesheet"/>
    <link href="../../../static/css/style.css" th:href="@{/css/style.css}" rel="stylesheet"/>
    <link href="../../../static/udi/css/jt-ui.css" th:href="@{/udi/css/jt-ui.css}" rel="stylesheet"/>
    <style>
        div.xrequired:before {
            content: '*';
            color: red;
        }
        .span {
            position:relative;
            padding:5px;
        }
        .tip {
            display:block;
            background:#f00;
            border-radius:50%;
            width:8px;
            height:8px;
            top:0px;
            right:0px;
            position:absolute;
        }
    </style>
</head>
<body>
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="form-di-list">
                <div class="select-list">
                    <ul>
                        <li>
                            企业名称：<select name="deptId" id="deptName"></select>
                        </li>
                        <li>
                            器械标识(DI)：<input type="text" name="di" id="di"/>
                        </li>
                        <li>类型：
                            <select value="" name="sel_type">
                                <option value="all">所有</option>
                                <option value="day">当天</option>
                                <option value="week">最近一周</option>
                                <option value="month">最近一月</option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
                    <i class="fa fa-remove"></i>&nbsp;&nbsp;清空
                </a>
            </div>
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="../../../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
<script src="../../../static/js/bootstrap.min.js" th:src="@{/js/bootstrap.min.js}"></script>
<script src="../../../static/ajax/libs/bootstrap-table/bootstrap-table.min.js" th:src="@{/ajax/libs/bootstrap-table/bootstrap-table.min.js}"></script>
<script src="../../../static/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js" th:src="@{/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js}"></script>
<script src="../../../static/udi/dist/layui.js" th:src="@{/udi/dist/layui.js}"></script>
<script src="../../../static/ajax/libs/blockUI/jquery.blockUI.js" th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script>
<script src="../../../static/udi/js/common.js" th:src="@{/udi/js/common.js}"></script>
<script src="../../../static/udi/js/jt-ui.js" th:src="@{/udi/js/jt-ui.js}"></script>
<script th:inline="javascript">

    $(function (){
        $.get("/gs1manage/getDeptMes",{},function (res) {
            $('#deptName').empty();
            $('#deptName').append('<option value="">----请选择----</option>');
            $.each(res,function (i,o) {
                $('#deptName').append('<option value='+o.deptId+'>'+o.deptName+'</option>');
            })
        })
        var prefix = "/gs1manage";
        var options = {
            url: prefix + "/getlistls",
            detailUrl: prefix + "/detaills/{id}",
            removeUrl: prefix + "/delete",
            sortName: "a.pi_id",
            modalName: "GS1-128码",
            columns: [
                {
                    checkbox: true},
                {
                    field: 'piId',
                    title: 'ID',
                    align: 'center'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.piId + '\')">详情</a> ');
                        return actions.join('');
                    }
                },
                {
                    field: 'deptName',
                    title: '企业名称',
                    align: 'center',
                },
                {
                    field: 'udi',
                    title: 'GS1-128码',
                    align: 'center',
                },
                {
                    field: 'delFlag',
                    title: '状态',
                    align: 'center',
                },
                {
                    field: 'addTime',
                    title: '生成时间',
                    sortable: true
                }]
        };
        $.table.init(options);
    })
    //格式化时间
    function getNowFormatDate() {
        var now = new Date();
        var date = now.getFullYear()
            + "-" + (now.getMonth()>8?(now.getMonth()+1):"0"+(now.getMonth()+1))
            + "-" + (now.getDate()>9?now.getDate():"0"+now.getDate())
            + " " + (now.getHours()>9?now.getHours():"0"+now.getHours())
            + ":" + (now.getMinutes()>9?now.getMinutes():"0"+now.getMinutes())
            + ":" + (now.getSeconds()>9?now.getSeconds():"0"+now.getSeconds());
        return date;
    }
</script>
</body>
</html>